package com.djakapm.markdown.editor.component.listener;

import javax.swing.event.UndoableEditEvent;
import javax.swing.event.UndoableEditListener;
import javax.swing.undo.UndoManager;
import javax.swing.undo.UndoableEdit;

public class UndoListener implements UndoableEditListener {
    private UndoManager undoManager;
    

    public UndoListener(UndoManager undoManager){
        this.undoManager = undoManager;
    }

    public void undoableEditHappened(UndoableEditEvent e) {
        UndoableEdit undoableEdit = e.getEdit();
        this.undoManager.addEdit(undoableEdit);
    }
}
